<?php

namespace App\depository;

use App\Models\CmdModel;

class CmdDep
{
    public $model;

    public function __construct()
    {
        $this->model = new CmdModel();
    }

    public function add($data)
    {
        $res = $this->model->insert($data);
        return $res;
    }

    public function upd($id, $data)
    {
        $res = $this->model->where('id', $id)->update($data);
        return $res;
    }

    public function del($ids)
    {
        $res = $this->model->whereIn('id', $ids)->delete();
        return $res;
    }

    public function list($param)
    {
        $res = $this->model
            ->where('team_id', $param['team_id'])
            ->orderBy('id', 'desc')
            ->paginate($param['per_page'], ['*'], 'page', $param['current_page']);;
        return $res;
    }

}
